<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>流程任务</title>
	<link href="../../build/common/base.css" rel="stylesheet">
	<script type="text/javascript" src="../../build/common/base.js"></script>
	<script type="text/javascript" src="../../build/common/gridList.js"></script>
</head>
<body>
<div class="panel-body" style="padding-bottom:0px;">
     <div class="panel panel-default search-panel">
         <div class="panel-heading" data-toggle="collapse" toggle="true" data-target="#formSearch" >查询条件</div>
         <div class="panel-body">
             <form id="searchForm" class="form-horizontal">
                 <div class="form-group">
                     <label class="control-label col-sm-1" for="name_^VLK">名字</label>
                     <div class="col-sm-3">
                         <input type="text" class="form-control" id="name_^VLK">
                     </div>
                     <label class="control-label col-sm-1" for="subject_^VLK">标题</label>
                     <div class="col-sm-3">
                         <input type="text" class="form-control" id="subject_^VLK">
                     </div>
                     <div class="col-sm-4" style="text-align:left;">
                     		<button type="button" style="margin-left: 50px" class="btn btn-primary fa-search">查询</button>
							<button type="button" style="margin-left: 50px" class="btn btn-primary fa-rotate-left">重置</button>
                     </div>
                 </div>
             </form>
         </div>
     </div>       
	<!--  <div class="btn-group toolbar">
          <button class="btn btn-outline btn-primary fa-remove">删除</button>
      </div> -->
      <table ab-grid data-id-field="id" data-url="/bpm/task/listJson">
          <thead>
          <tr>
              <th data-checkbox="true"></th>
              <th data-field="subject">任务标题</th>
              <th data-field="name">任务名称</th>
              <th data-field="assigneeNames">候选人</th>
              <th data-field="taskType" data-formatter="labelFormatter" 
              			data-value-style="NORMAL-普通-primary,SIGN-会签-info,SIGN_SOURCE-会签_父-info,TRANSFORMING-事项-warning,">类型</th>
              <th data-field="status" data-formatter="labelFormatter" 
              			data-value-style="NORMAL-普通-primary,SUSPEND-挂起-info,LOCK-锁定-warning,BACK-驳回-warning,DESIGNATE-指派-info,TURN-转办-info,AGENCY-代理-info,">状态</th>
              <th data-field="createTime" data-formatter=dateTimeFormatter data-sort-name="create_time_" data-sortable="true">任务创建时间</th>
              <th data-formatter="innerHtmlFormatter" data-title="管理">
					<!-- <a class="fa-detail btn btn-outline btn-primary btn-sm" openDialog="明细"   url="taskGet?id={taskId}" qtip="明细"></a> -->
					<span class="fa-check-circle btn btn-outline btn-primary btn-sm" openDialog="处理"  top="true" qtip="新窗口处理" url="/bpm/task/taskComplete.html?taskId={id}"></span>
					<span class="fa-user btn btn-outline btn-primary btn-sm" top="true" qtip="指派候选人" onclick="assignUser('{id}')"></span>
					<span if="'{status}'==='DESIGNATE'" class="fa-refresh btn btn-outline btn-primary btn-sm" top="true" qtip="取消指派" sendAction="取消指派" url="/bpm/task/unLock?taskId={id}"></span>
					
			  </th>
          </tr>
          </thead>
      </table>
    </div>
</body>
<script type="text/javascript">
	function assignUser (taskId){
		CustUtil.openCustDialog("userSelector",function(arrData,innerWindow){
		    var param = {userId:arrData[0].id,userName:arrData[0].name,taskId:taskId};
			
			$.post(__ctx+"/bpm/task/assignTask",param,function(responseText){
				var result	= eval('(' + responseText + ')');
				if (result.isOk) {
					$.Toast.success('指派成功！', function() {
						reloadGrid();
					});
				} else {
					$.Toast.error(result.msg);
				}
			})
		    $.Dialog.close(innerWindow);
		},null,{ multiple : false})
		
		
	}
	

</script>
</html>